﻿
@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<script src="~/Content/js/cart.js"></script>
<script src="~/Content/js/jquery-1.8.2.min.js"></script>
<div class="cart-box">

    <!--步骤图-->
    <div class="cart-buzhou">
        <img src=" ~/Content/images/cart-move.jpg" alt="">

    </div>
    <!--步骤图end-->
    <!--购物车-->
    <div class="catbox">
        <table id="cartTable">
            <thead>
                <tr>
                    <th><label><input class="check-all check" type="checkbox" />&nbsp;全选</label></th>
                    <th>商品</th>
                    <th>单价</th>
                    <th>数量</th>
                    <th>小计</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody>

                @foreach (var item in Model)
                {
                    <tr>
                        <td class="checkbox"><input class="check-one check" type="checkbox" /></td>
                        <td class="cart-goods"><img src=" ~/Content/@item.ProductPrth" alt="" /><span><a href="" class="cart-goods-link">@item.ProductName</a></span></td>
                        <td class="price">@item.Price</td>
                        <td class="count"><span class="reduce"></span><input class="count-input" type="text" value="@item.Count" /><span class="add">+</span></td>
                        <td class="subtotal">@item.Price</td>
                        <td ><a class="Delete"  data-id="@item.Id">删除</a></td>
                    </tr>
                }
            </tbody>
        </table>

        <div class="foot" id="foot">
            <label class="fl select-all"><input type="checkbox" class="check-all check" data-id="1" />&nbsp;全选</label>
            <a class="fl delete" id="deleteAll" href="javascript:;">删除</a>
            <div class="fr closing"><a href="~/Shopping/Cart1">结 算</a></div>
            <div class="fr total">合计：￥<span id="priceTotal">0.00</span></div>
            <div class="fr selected" id="selected">已选商品<span id="selectedTotal">0</span>件<span class="arrow up">︽</span><span class="arrow down">︾</span></div>
            <div class="selected-view">
                <div id="selectedViewList" class="clearfix">
                    <div><img src=" ~/Content/images/1-1.jpg"><span>取消选择</span></div>
                </div>
                <span class="arrow">◆<span>◆</span></span>
            </div>
        </div>

    </div>
    <!--购物车end!-->
</div>

<script>
    $(".Delete").click(function () {
       
        var id = $(this).data("id");
        var _this = this;
        $.post("/Shopping/Delete", { Id: id }, function (res) {
            if (res.Success) {
                alert(res.Message)
                window.location.href = "/Shopping/Index"
            } else {
                alert(res.Message)
            }
        })
    } )
</script>

<script>
    $(".check-all check").click(function () {
        var id = $(this).data("id");
        alert(id)
    })

</script>

